package com.qhy.service.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qhy.mapper.TbCommentsMapper;
import com.qhy.pojo.TbComments;
import com.qhy.pojo.TbCommentsExample;
import com.qhy.pojo.TbCommentsExample.Criteria;
import com.qhy.service.ICommentsService;

@Service
public class CommentService implements ICommentsService  {
	
	@Resource
	private TbCommentsMapper commentsMapper;

	public List<TbComments> queryAll() {
		return commentsMapper.selectByExample(null);
	}

	public boolean delete(Integer cm_id) {
		return commentsMapper.deleteByPrimaryKey(cm_id)==1?true:false;
	}

	public List<TbComments> queryByPsId(Integer psId) {
		TbCommentsExample example = new TbCommentsExample();
		Criteria criteria = example.createCriteria();
		criteria.andCmPsIdEqualTo(psId);
		return commentsMapper.selectByExample(example);
	}
	
	
	
	
}
